{% set title = 'Error Request Report' %}
{% extends "ereporter2/base.html" %}


{% block header %}
<style>
  h1 {
    margin-top: 10px;
    margin-bottom: 10px;
  }

  h3 {
    margin-bottom: 5px;
  }

  table.property_table {
    font-family: monospace;
    border-spacing: 0;
  }

  table.property_table thead {
    white-space: nowrap;
  }

  table.property_table tbody tr:nth-child(even) {
    background-color: #eeeeee;
  }

  table.property_table th {
    padding-left: 1em;
    padding-right: 1em;
  }

  table.property_table td {
    padding-left: 1em;
    padding-right: 1em;
  }

  .large {
    min-width: 150px;
  }


  table.property_table tbody tr:hover {
    background-color: #eeffee;
  }
</style>
{% endblock %}


{% block body %}
<h1>Recent Errors</h1>
<p>
{% if errors %}
  <table id="error-table" class="property_table"
      summary="This table lists most recent errors">
    <thead>
      <th>Timestamp</th>
      <th>Source</th>
      <th>Category</th>
      <th>Identity</th>
      <th>Message</th>
      <th>Exception type</th>
      <th>Hostname</th>
      <th>Source IP</th>
      <th>Version</th>
      <th>Endpoint</th>
    </thead>
    <tbody>
      {% for error in errors %}
        <tr class="request">
          <td nowrap>
            <a href="/restricted/ereporter2/errors/{{error.key.integer_id()}}">
              {{error.created_ts|datetimeformat}}
            </a>
          </td>
          <td>{{error.source}}</td>
          <td>{{error.category or '--'}}</td>
          <td>{{error.identity or '--'}}</td>
          <td><pre>{{(error.message or '--')|truncate(200, true)}}</pre></td>
          <td>{{error.exception_type or '--'}}</td>
          <td>{{error.hostname or '--'}}</td>
          <td nowrap>{{error.source_ip or '--'}}</td>
          <td>{{error.version or '--'}}</td>
          <td>{{error.endpoint or '--'}}</td>
        </tr>
      {% endfor %}
    </tbody>
  </table>

  {% if cursor %}
    <a href="/restricted/ereporter2/errors?limit={{limit}}&cursor={{cursor}}"}>
      Next page
    </a>
  {% endif %}
{% else %}
  No error was logged. The system is healthy or unused!
{% endif %}

{% endblock %}
